package study.designpattern.vistorpattern;

import study.designpattern.vistorpattern.element.Body;
import study.designpattern.vistorpattern.element.CarElement;
import study.designpattern.vistorpattern.element.Engine;
import study.designpattern.vistorpattern.element.Wheel;
import study.designpattern.vistorpattern.visitor.CarElementDoVisitor;
import study.designpattern.vistorpattern.visitor.CarElementPrintVisitor;
import study.designpattern.vistorpattern.visitor.IVisitor;

public class MainVisitor {
    public static void main(String[] args) {
        CarElement engine = new Engine();
        CarElement wheel = new Wheel();
        CarElement carBody = new Body();
        
        IVisitor carElementPrintVisitor = new CarElementPrintVisitor();
        IVisitor carElementDoVisitor = new CarElementDoVisitor();
        engine.accept(carElementPrintVisitor);
        wheel.accept(carElementPrintVisitor);
        carBody.accept(carElementPrintVisitor);
        System.out.println();
        
        engine.accept(carElementDoVisitor);
        wheel.accept(carElementDoVisitor);
        carBody.accept(carElementDoVisitor);
        
    }
}
